import request from '@/router/axios'

export function goodsFetchList(query) {
  return request({
    url: '/eims/goods/page',
    method: 'get',
    params: query
  })
}

export function getGoodsList(query) {
  return request({
    url: '/eims/goods/goods2dList',
    method: 'get',
    params: query
  })
}

export function goodsAddObj(obj) {
  return request({
    url: '/eims/goods',
    method: 'post',
    data: obj
  })
}

//  批量新增镜片成品片
export function batchAddCtgSale3(obj) {
  return request({
    url: '/eims/goods/saveBatchGoodsByGlass',
    method: 'post',
    data: obj
  })
}

//  批量新增隐形成品片
export function batchAddCtgSale4(obj) {
  return request({
    url: '/eims/goods/saveBatchGoodsByInvisible',
    method: 'post',
    data: obj
  })
}

//  批量启用/停用商品
export function batchUpdateGoods(obj) {
  return request({
    url: '/eims/goods/batchUpdateGoods',
    method: 'put',
    data: obj
  })
}

//  重新生成商品名称
export function genViewName(query) {
  return request({
    url: '/eims/goods/genViewName',
    method: 'get',
    params: query
  })
}


export function goodsGetObj(id) {
  return request({
    url: '/eims/goods/' + id,
    method: 'get'
  })
}

export function goodsDelObj(id) {
  return request({
    url: '/eims/goods/' + id,
    method: 'delete'
  })
}

export function goodsPutObj(obj) {
  return request({
    url: '/eims/goods',
    method: 'put',
    data: obj
  })
}

// 盘盈时,分页查询商品信息
export function getCheckGoodsByFull(obj) {
  return request({
    url: '/eims/goods/getGoodsVosWithPricePage',
    method: 'get',
    params: obj
  })
}

//盘亏时，分页查询商品信息
export function getCheckGoodsInfo(query) {
  return request({
    url: '/eims/goods/getCheckGoodsPage',
    method: 'get',
    params: query
  })
}

//  查询商品信息-带销售价格
export function getGoodsPriceData(query) {
  return request({
    url: '/eims/goods/getGoodsVosWithPricePage',
    method: 'get',
    params: query
  })
}


export function returnGoodsList(query) {
  return request({
    url: '/eims/goods/returnGoodsPage',
    method: 'get',
    params: query
  })
}

//根据code获取商品信息
export function getInfoByCode(code) {
  return request({
    url: '/eims/goods/code/' + code,
    method: 'get'
  })
}


//  批量删除
export function batchRemove(obj) {
  return request({
    url: '/eims/goods/batchRemoveByIds',
    method: 'get',
    params: obj
  })
}

//零售价调整页面使用按品种型号分类查询
export function getGoodsListUseAdPrice(query) {
  return request({
    url: '/eims/goods/getGoodsListUseAdPrice',
    method: 'get',
    params: query
  })
}

// 批量修改商品成本价
export function batchEditCostPrice(price,obj){
  return request({
    url: '/eims/goods/updateNotTaxPrice?price=' + price,
    method: 'post',
    data: obj
  })
}
